<?php
/**
 *	Collection of SQL Statements for Users.
 *	@package		mv2.collection
 *	@author			Christian Würker <Christian.Wuerker@CeuS-Media.de>
 *	@since			29.08.2007
 *	@version		0.1
 */
/**
 *	Collection of SQL Statements for Users.
 *	@package		mv2.collection
 *	@extends		Database_StatementCollection
 *	@author			Christian Würker <Christian.Wuerker@CeuS-Media.de>
 *	@since			29.08.2007
 *	@version		0.1
 */
class Collection_User extends Database_StatementCollection
{
	public function collectUsers()
	{
		$keys	= array(
			"DISTINCT u.userId",
			"u.creatorId",
			"u.username",
			"u.email",
			"u.status",
			"u.language",
			"u.created",
			"u.modified",
			"u.logged",
		);
		$tables	= array(
			"users as u",
		);
		$conditions	= array(
		);
		$this->builder->addKeys( $keys );
		$this->builder->addTables( $tables );
		$this->builder->addConditions( $conditions );
	}

	public function withEmailLike( $email )
	{
		$condition	= "u.email LIKE '%".$email."%'";
		$this->builder->addCondition( $condition );
	}	
		
	public function withUserId( $id )
	{
		$condition	= "u.userId=".(int)$id;
		$this->builder->addCondition( $condition );
	}

	public function withUsernameLike( $username )
	{
		$condition	= "u.username LIKE '%".$username."%'";
		$this->builder->addCondition( $condition );
	}	
}
?>
